library(knitr)
library(dplyr)
library(tidyverse)
library(ggplot2)
library(gridExtra)
library(magrittr)
library(plotly)
library(ggpubr)
library(patchwork)
library(ggmosaic)

1 Importing Data

df <- read.csv("Bidit_Life_data_tracking.csv",header = T, stringsAsFactors = T )

2 Exploratory Data Analysis

2.1 A short overview on my habits,health and mindset

2.1.1 Mindset,Mood & Focus

mindset <- data.frame(table(df$Mindset.Motivated.Yes.Lazy.No.))
basic_1 <-ggplot(mindset, aes(y=Freq, x=Var1)) +
  geom_bar(position="dodge", stat="identity",fill="#FFCC66")+theme_minimal() + geom_text(aes(label = Freq), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("No","Yes"))+xlab("Mindset is Positive")+ylab("Count")+ylim(0,113)


positivity <- data.frame(table(df$Positivity..1.worst.5.best.))
colnames(positivity) <- c("Mood_Rating","Count")
basic_2 <-ggplot(positivity, aes(y=Count, x=Mood_Rating)) +
  geom_bar(position="dodge", stat="identity",fill="#FFCC66")+theme_minimal() + geom_text(aes(label = Count), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("Worst","Bad","Moderate","Good","Too Good"))+xlab("Mood Rating")+ylab("Count")+ylim(0,113)

focus <- data.frame(table(df$Focus.Level..1.worst.5.best.))
focus_plot <- ggplot(focus, aes(y=Freq, x=Var1)) +
  geom_bar(position="dodge", stat="identity",fill="#FFCC66")+theme_minimal() + geom_text(aes(label = Freq), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("<10mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90mins"))+xlab("Focus Time")+ylab("Count")+ylim(0,113)


figure <- ggarrange(
  focus_plot,                # First row
  # Second Row
  ggarrange(basic_1, basic_2, ncol = 2, labels = c("Mindset", "Mood")), 
  nrow = 2, 
  labels = "Focus Time"       # Label of the plot
  ) 
annotate_figure(figure, top = text_grob("Visualizing Mood,Mindset & Focus Time",
                  color = "red", face = "bold", size = 14),
  bottom = text_grob("Data source:Bidit Personal Notion Database", color = "black",
                     hjust = 1, x = 1, face = "italic", size = 10),
  fig.lab = "Figure 1", fig.lab.face = "bold"
  )

2.1.1.1 Insights on Mindset, Focus and Mood

  • My Focus time is satisfactory where 37 out of 113 days,I have focused more than 1 hour.
  • I mostly have negative attitude towards most of the daily problems and difficulties that I have faced in this 113 days.
  • Although I have a negative mindset but my mood remained more or less OK.

2.1.2 Health

#exercise
exercise <- data.frame(table(df$Exercise))
colnames(exercise) <- c("Exercise","Frequency1")
exercise_plot <- ggplot(exercise, aes(y=Frequency1, x=Exercise)) +
  geom_bar(position="dodge", stat="identity",fill="#FF6666")+theme_minimal() + geom_text(aes(label = Frequency1), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("No","Yes"))+xlab("Exercise")+ylab("Count")+ylim(0,113)

#health
health_condition <- data.frame(table(df$Health.Condition..5.Best..1.worst.))
colnames(health_condition) <- c("Health","Frequency2")
health_condition_plot <- ggplot(health_condition, aes(y=Frequency2, x=Health)) +
  geom_bar(position="dodge", stat="identity",fill="#FF6666")+theme_minimal() + geom_text(aes(label = Frequency2), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("Extremely Sick","Sick","OK","Good","Healthy,Energetic"))+xlab("Health Condition")+ylab("Count")+ylim(0,113)

#diet calculations
diet <- data.frame(table(df$Diet..1..worst..to.5..best.))
colnames(diet) <- c("Diet","Frequency3")

diet_plot <- ggplot(diet, aes(y=Frequency3, x=Diet)) +
  geom_bar(position="dodge", stat="identity",fill="#FF6666")+theme_minimal() + geom_text(aes(label = Frequency3), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("Junk","Unbalanced","OK","Healthly","Balanced"))+xlab("Diet Level")+ylab("Count")+ylim(0,113)

#plotting
figure1 <- ggarrange(
  health_condition_plot,                # First row with line plot
  # Second row with box and dot plots
  ggarrange(exercise_plot, diet_plot, ncol = 2, labels = c("Exercise ", "Diet Levels")), 
  nrow = 2, 
  labels = "Health"       # Label of the line plot
  ) 
annotate_figure(figure1, top = text_grob("Visualizing Health,Diet & Exercise",
                  color = "red", face = "bold", size = 14),
  bottom = text_grob("Data source:Bidit Personal Notion Database", color = "black",
                     hjust = 1, x = 1, face = "italic", size = 10),
  fig.lab = "Figure 2", fig.lab.face = "bold"
  )

2.1.2.1 Insights on Diet, Exercise, Health Condition

  • My health condition shows a concern as I have been good and energetic for only 43 days also 34 days is OK with significant amount of fatigue and weakness in my body.
  • I have sincerely exercised for most of the days, 85 out of 113 days.
  • The Diet level is OK with not so significant problems which I could find.
#water consumption calculation
# Creating the month coloumn
df$Month <- as.factor(format(df$On.This.Day,"%b"))
levels(df$Month) <- c(4,5,3,2,1) # Changing factor levels as the ordering is not same
water_consumption <- data.frame(tapply(df$Water.Consumption.in.litre.,df$Month,mean))
df2 <- na.omit(df)   # omitting na values in workout time
water_grandmean <- round(mean(df$Water.Consumption.in.litre.),1)
water_consumption_plot <- ggplot(df,aes(x=Month, y=Water.Consumption.in.litre.,fill=Month))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab(" Drinking Water Consumption (in litre)")+geom_hline(aes(yintercept=water_grandmean),colour="#6666CC",lwd=1)+geom_text(aes(0,water_grandmean,label= paste("Average/day",water_grandmean,sep = ":"),vjust=-1,hjust=0),colour="#6666FF")+stat_summary(fun = mean,geom="point",shape=20,size=5,color="red",fill="red")+scale_x_discrete(labels=c("Sep","Oct","Nov","Dec","Jan"))

#Workout calculation
workout_time <- data.frame(tapply(df2$Workout.time.in.mins.,df2$Month,mean))
workout_grandmean <- round(mean(df2$Workout.time.in.mins.),1)

workout_time_plot <- ggplot(df2,aes(x=Month, y=Workout.time.in.mins.,fill=Month))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab("Workout Time (in hour)")+geom_hline(aes(yintercept=workout_grandmean),colour="#6666CC",lwd=1)+geom_text(aes(0,workout_grandmean,label= paste("Average/day",workout_grandmean,sep = ":"),vjust=-1,hjust=0),colour="#6666FF")+stat_summary(fun = mean,geom="point",shape=20,size=5,color="red",fill="red")+scale_x_discrete(labels=c("Sep","Oct","Nov","Dec","Jan"))


#sleep time calculation
sleep_grandmean <- round(mean(df$Sleep.Time.day),1)
sleep_time_plot <- ggplot(df,aes(x=Month, y=Sleep.Time.day,fill=Month))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab("Sleeping Time(in hour)")+geom_hline(aes(yintercept=sleep_grandmean),colour="#6666CC",lwd=1)+geom_text(aes(0,sleep_grandmean,label= paste("Average/day",sleep_grandmean,sep = ":"),vjust=2,hjust=0),colour="#6666FF")+stat_summary(fun = mean,geom="point",shape=20,size=5,color="red",fill="red")+scale_x_discrete(labels=c("Sep","Oct","Nov","Dec","Jan"))


#plotting
figure2 <- ggarrange(
  water_consumption_plot,                # First row with line plot
  # Second row with box and dot plots
  ggarrange(workout_time_plot, sleep_time_plot, ncol = 2, labels = c("Workout Time", "Sleeping Time")), 
  nrow = 2, 
  labels = " Drinking Water Consumption"       # Label of the line plot
  ) 
annotate_figure(figure2, top = text_grob("Visualizing Daily Essential Needs & Activities",
                  color = "red", face = "bold", size = 14),
  bottom = text_grob("Data source:Bidit Personal Notion Database", color = "black",
                     hjust = 1, x = 1, face = "italic", size = 10),
  fig.lab = "Figure 2", fig.lab.face = "bold"
  )

2.1.2.2 Insights on Daily Needs and Activities

  • My average Drinking Water consumption per day is comparatively less than what an Indian male should consume according to experts(3-litre).
  • The monthly average of drinking water consumption per day except for September is more or less OK.
  • On an average I have exercised for at least an hour per day which is a good sign for me. The monthly workout time also gives a positive look.
  • Average sleeping time per day is 7.1 hours per day which is a little less than what an average person need (8 hours). But there is no such bigger concern as I can see from the boxplot.

2.1.3 Hobbies & Extra-Curricular Activities

#meditation
meditation <- data.frame(table(df$Meditation))
colnames(meditation) <- c("Medi","Frequencymed")
meditation_plot <- ggplot(meditation, aes(y=Frequencymed, x=Medi)) +
  geom_bar(position="dodge", stat="identity",fill="#CCFF00")+theme_minimal() + geom_text(aes(label = Frequencymed), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("No","Yes"))+xlab("Meditation")+ylab("Count")+ylim(0,113)

#reading
reading <- data.frame(table(df$Reading..Doesn.t.include.Studying.))
colnames(reading) <- c("Reading","Frequencyread")
reading_plot <- ggplot(reading, aes(y=Frequencyread, x=Reading)) +
  geom_bar(position="dodge", stat="identity",fill="#CCFF00")+theme_minimal() + geom_text(aes(label = Frequencyread), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("No","Yes"))+xlab("Reading")+ylab("Count")+ylim(0,113)

#morning prayer
prayer <- data.frame(table(df$Morning.Prayer))
colnames(prayer) <- c("Prayer","Frequencypray")
prayer_plot <- ggplot(prayer, aes(y=Frequencypray, x=Prayer)) +
  geom_bar(position="dodge", stat="identity",fill="#CCFF00")+theme_minimal() + geom_text(aes(label = Frequencypray), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("No","Yes"))+xlab("Morning Prayer")+ylab("Count")+ylim(0,113)

# Phone time
phone_grandmean <- round(mean(df$Phone.Time.in.mins.),1)
phone_time_plot <- ggplot(df,aes(x=Month, y=Phone.Time.in.mins.,fill=Month))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab("Phone Usage Time(in hour)")+geom_hline(aes(yintercept=phone_grandmean),colour="#6666CC",lwd=1)+geom_text(aes(0,phone_grandmean,label= paste("Average/day",phone_grandmean,sep = ":"),vjust=1,hjust=0),colour="#6666FF")+stat_summary(fun = mean,geom="point",shape=20,size=5,color="red",fill="red")+scale_x_discrete(labels=c("Sep","Oct","Nov","Dec","Jan"))


#plotting
figure3 <- ggarrange(
  phone_time_plot,                # First row with line plot
  # Second row with box and dot plots
  ggarrange(meditation_plot, reading_plot, ncol = 2, labels = c("Meditation", "Reading")), 
  nrow = 2, 
  labels = " Phone Usage Time"       # Label of the line plot
  ) 
annotate_figure(figure3, top = text_grob("Visualizing Daily Essential Needs & Activities",
                  color = "red", face = "bold", size = 14),
  bottom = text_grob("Data source:Bidit Personal Notion Database", color = "black",
                     hjust = 1, x = 1, face = "italic", size = 10),
  fig.lab = "Figure 2", fig.lab.face = "bold"
  )

2.1.3.1 Insights on Phone Usage time , Meditation and Reading

  • My phone usage time is 2.4 hours per day, which I cannot complain as most of my books are also there. But there is not so much to be concerned about as the max value of phone usage is less than 5 hours. In case of October I have greater phone usage time compared to other months.
  • I have sincerely meditated for 76 days out of 113 days which is good.
  • In case of reading as we can see from the bar plot, I have read only for 13 days out of 113 days, which I seem to have totally neglected.

2.2 Activities,Health & Mindset on Focus Time

2.2.1 Meditation on Focus Time

q <- table(df$Focus.Level..1.worst.5.best.,df$Meditation)
q_prop <- round(prop.table(q,margin = 2),2)*100
p <- addmargins(q)
rownames(p) <- c("<=10min","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins","Sum")
t <- as.matrix(p)
z <- data.frame(q_prop)
colnames(z) <- c("Focus_Level","Meditation_Status","Count")

fig1 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Focussed Time</b>", "<b>Meditation:No</b>","<b>Meditation:Yes</b>","<b>Sum</b>"),
  align = c('left', rep('center', ncol(t))),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'rgb(235, 100, 230)'),
  font = list(family = "Arial", size = 14, color = "white")
  ),
  cells = list(
    values = rbind(
      rownames(t), 
      t(as.matrix(unname(t)))
    ),
    align = c('left', rep('center', ncol(t))),
    line = list(color = "black", width = 1),
    fill = list(color = c('rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)')),
    font = list(family = "Arial", size = 12, color = c("black"))
  ))

fig1
plot_1 <-ggplot(z, aes(fill=Meditation_Status, y=Count, x=Focus_Level)) +
  geom_bar(position="dodge", stat="identity",colour="black")+theme_minimal() + geom_text(aes(label = paste(Count,"%",sep = "")), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+xlab("Focus Time")+ylab("Percentage")+labs(title="MEDITATION & FOCUS TIME",caption = "Data Source:Bidit Personal Notion Database",tag = "Figure-1",fill="Meditation Done")+coord_flip()
plot_1

2.2.1.1 Insights of Exercise on Focus Time

  • From Figure-1 bar plot of meditation & Focus Time, the plot shows, that for focus time greater than 30 mins I have a greater percentage that I have meditated.

2.2.2 Exercise on Focus Time

q1 <- table(df$Focus.Level..1.worst.5.best.,df$Exercise)
q1_prop <- round(prop.table(q1,margin = 2),2)*100
p1 <- addmargins(q1)
rownames(p1) <- c("<=10min","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins","Sum")
t1 <- as.matrix(p1)
z1 <- data.frame(q1_prop)
colnames(z1) <- c("Focus_Level","Exercise_Status","Count")

fig3 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Focussed Time</b>", "<b>Exercise:No</b>","<b>Exercise:Yes</b>","<b>Sum</b>"),
  align = c('left', rep('center', ncol(t1))),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'rgb(235, 100, 230)'),
  font = list(family = "Arial", size = 14, color = "white")
  ),
  cells = list(
    values = rbind(
      rownames(t1), 
      t(as.matrix(unname(t1)))
    ),
    align = c('left', rep('center', ncol(t))),
    line = list(color = "black", width = 1),
    fill = list(color = c('rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)')),
    font = list(family = "Arial", size = 12, color = c("black"))
  ))

fig3
plot_2 <-ggplot(z1, aes(fill=Exercise_Status, y=Count, x=Focus_Level)) +
  geom_bar(position="dodge", stat="identity",colour="black")+theme_minimal() + geom_text(aes(label = paste(Count,"%",sep = "")), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+xlab("Focus Time")+ylab("Percentage")+labs(title="EXERCISE & FOCUS TIME",caption = "Data Source:Bidit Personal Notion Database",tag = "Figure-2",fill="Exercise Done")+coord_flip()
plot_2

2.2.2.1 Insights of Exercise on Focus time

  • I cannot conclude much from this plot.

2.2.3 Reading on Focus Time

q2 <- table(df$Focus.Level..1.worst.5.best.,df$Reading..Doesn.t.include.Studying.)
q2_prop <- round(prop.table(q2,margin = 2),2)*100
p2 <- addmargins(q2)
rownames(p2) <- c("<=10min","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins","Sum")
t2 <- as.matrix(p2)
z2 <- data.frame(q2_prop)
colnames(z2) <- c("Focus_Level","Reading_Status","Count")

fig3 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Focussed Time</b>", "<b>Reading:No</b>","<b>Reading:Yes</b>","<b>Sum</b>"),
  align = c('left', rep('center', ncol(t2))),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'rgb(235, 100, 230)'),
  font = list(family = "Arial", size = 14, color = "white")
  ),
  cells = list(
    values = rbind(
      rownames(t2), 
      t(as.matrix(unname(t2)))
    ),
    align = c('left', rep('center', ncol(t2))),
    line = list(color = "black", width = 1),
    fill = list(color = c('rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)')),
    font = list(family = "Arial", size = 12, color = c("black"))
  ))

fig3
plot_3 <-ggplot(z2, aes(fill=Reading_Status, y=Count, x=Focus_Level)) +
  geom_bar(position="dodge", stat="identity",colour="black")+theme_minimal() + geom_text(aes(label = paste(Count,"%",sep = "")), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+xlab("Focus Time")+ylab("Percentage")+labs(title="READING & FOCUS TIME",caption = "Data Source:Bidit Personal Notion Database",tag = "Figure-3",fill="Reading Done")+coord_flip()
plot_3

2.2.3.1 Insights of Reading on Focus Time

  • This plot shows how focus time is varying based on if I have read a book or not that day.

2.2.4 Mindset on Focus time

q3 <- table(df$Focus.Level..1.worst.5.best.,df$Mindset.Motivated.Yes.Lazy.No.)
q3_prop <- round(prop.table(q3,margin = 2),2)*100
p3 <- addmargins(q3)
rownames(p3) <- c("<=10min","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins","Sum")
t3 <- as.matrix(p3)
z3 <- data.frame(q3_prop)
colnames(z3) <- c("Focus_Level","Mindset_Status","Count")

fig4 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Focussed Time</b>", "<b>Mindest Positive:No</b>","<b>Mindset Positive:Yes</b>","<b>Sum</b>"),
  align = c('left', rep('center', ncol(t2))),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'rgb(235, 100, 230)'),
  font = list(family = "Arial", size = 14, color = "white")
  ),
  cells = list(
    values = rbind(
      rownames(t3), 
      t(as.matrix(unname(t3)))
    ),
    align = c('left', rep('center', ncol(t2))),
    line = list(color = "black", width = 1),
    fill = list(color = c('rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)')),
    font = list(family = "Arial", size = 12, color = c("black"))
  ))

fig4
plot_4 <-ggplot(z3, aes(fill=Mindset_Status, y=Count, x=Focus_Level)) +
  geom_bar(position="dodge", stat="identity",colour="black")+theme_minimal() + geom_text(aes(label = paste(Count,"%",sep = "")), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 4)+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+xlab("Focus Time")+ylab("Percentage")+labs(title="MINDSET & FOCUS TIME",caption = "Data Source:Bidit Personal Notion Database",tag = "Figure-4",fill="Mindset Positive")+coord_flip()
plot_4

2.2.4.1 Insights of Mindset on Focus time

  • The plot shows how the focus time is distributed based on the mindset of that day.

2.2.5 Diet on Focus time

q4 <- table(df$Focus.Level..1.worst.5.best.,df$Diet..1..worst..to.5..best.)
q4_prop <- round(prop.table(q4,margin = 2),2)*100
p4 <- addmargins(q4)
rownames(p4) <- c("<=10min","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins","Sum")
t4 <- as.matrix(p4)
z4 <- data.frame(q4_prop)
colnames(z4) <- c("Focus_Level","Diet_Level","Count")

fig5 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Focussed Time</b>", "<b>Diet Levels:1</b>","<b>2</b>","<b>3</b>","<b>4</b>","<b>5</b>","<b>Sum</b>"),
  align = c('left', rep('center', ncol(t4))),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'rgb(235, 100, 230)'),
  font = list(family = "Arial", size = 14, color = "white")
  ),
  cells = list(
    values = rbind(
      rownames(t4), 
      t(as.matrix(unname(t4)))
    ),
    align = c('left', rep('center', ncol(t4))),
    line = list(color = "black", width = 1),
    fill = list(color = c('rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)')),
    font = list(family = "Arial", size = 12, color = c("black"))
  )) 

fig5
plot_5 <-ggplot(z4, aes(fill=Diet_Level, y=Count, x=Focus_Level)) +
  geom_bar(position="dodge", stat="identity",colour="black")+theme_minimal() + geom_text(aes(label = paste(Count,"%",sep = "")), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 3)+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+xlab("Focus Time")+ylab("Percentage")+labs(title="DIET & FOCUS TIME",caption = "Data Source:Bidit Personal Notion Database",tag = "Figure-5",fill="Diet Level(1=Worst,5=Best)")+coord_flip()
plot_5
ggplot(data = df) +
  geom_mosaic(aes(x = product(Diet..1..worst..to.5..best., Focus.Level..1.worst.5.best.), fill = Diet..1..worst..to.5..best.),
              na.rm=TRUE) + 
  labs(x = "Focus Level", 
       y = "Proportion", 
       title="Focus Time by Diet Levels",
       subtitle = "Left - Right = (1) <10 mins - (5) >90 mins",
       caption = "Data Source:Bidit Notion Personal Database",
       tag="Fig-5") +
  scale_fill_manual(values=c("#440145FF", "#404788FF", "#238A8DFF", "#55C667FF", "#FDE725FF"), 
                    name="Diet Levels",
                    breaks=c("1", "2", "3", "4", "5"),
                    labels=c("1-Junk","2-Unbalanced","3-OK","4-Healthly","5-Balanced")) +
  theme_minimal() +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank())

Kendalls Correlation between diet levels and focus time

df$Focus.Level..1.worst.5.best. <- as.numeric(df$Focus.Level..1.worst.5.best.)
df$Diet..1..worst..to.5..best. <- as.numeric(df$Diet..1..worst..to.5..best.)

cor(df$Focus.Level..1.worst.5.best.,df$Diet..1..worst..to.5..best.,method = "kendall")
## [1] 0.03031855
df$Focus.Level..1.worst.5.best. <- as.factor(df$Focus.Level..1.worst.5.best.)
df$Diet..1..worst..to.5..best. <- as.factor(df$Diet..1..worst..to.5..best.)

2.2.5.1 Insights of Diet Level on Focus time

  • The mosaic plot shows us how with the change of diet the focus time has varied.
  • A very weak positive association seems to be there between diet level and focus time.

2.2.6 Health Condition on Focus Time

q5 <- table(df$Focus.Level..1.worst.5.best.,df$Health.Condition..5.Best..1.worst.)
q5_prop <- round(prop.table(q5,margin = 2),2)*100
p5 <- addmargins(q5)
rownames(p5) <- c("<=10min","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins","Sum")
t5 <- as.matrix(p5)
z5 <- data.frame(q5_prop)
colnames(z5) <- c("Focus_Level","Health_Condition","Count")

fig6 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Focussed Time</b>", "<b>Health Condition:1</b>","<b>2</b>","<b>3</b>","<b>4</b>","<b>5</b>","<b>Sum</b>"),
  align = c('left', rep('center', ncol(t5))),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'rgb(235, 100, 230)'),
  font = list(family = "Arial", size = 14, color = "white")
  ),
  cells = list(
    values = rbind(
      rownames(t5), 
      t(as.matrix(unname(t5)))
    ),
    align = c('left', rep('center', ncol(t5))),
    line = list(color = "black", width = 1),
    fill = list(color = c('rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)')),
    font = list(family = "Arial", size = 12, color = c("black"))
  ))

fig6
plot_6 <-ggplot(z5, aes(fill=Health_Condition, y=Count, x=Focus_Level)) +
  geom_bar(position="dodge", stat="identity",colour="black")+theme_minimal() + geom_text(aes(label = paste(Count,"%",sep = "")), fontface = "bold", vjust = .5, position = position_dodge(0.9), size = 3)+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+xlab("Focus Time")+ylab("Percentage")+labs(title="HEALTH CONDITION & FOCUS TIME",caption = "Data Source:Bidit Personal Notion Database",tag = "Figure-6",fill="Health Condition(1=Worst,5=Best)")+coord_flip()
plot_6
ggplot(data = df) +
  geom_mosaic(aes(x = product(Health.Condition..5.Best..1.worst., Focus.Level..1.worst.5.best.), fill = Health.Condition..5.Best..1.worst.),
              na.rm=TRUE) + 
  labs(x = "Focus Level", 
       y = "Proportion", 
       title="Focus Time by Health Condition",
       subtitle = "Left - Right = (1) <10 mins - (5) >90 mins",
       caption = "Data Source:Bidit Notion Personal Database",
       tag="Fig-6") +
  scale_fill_manual(values=c("#440145FF", "#404788FF", "#238A8DFF", "#55C667FF", "#FDE725FF"), 
                    name="Health Condition",
                    breaks=c("1", "2", "3", "4", "5"),
                    labels=c("1-Extremely Sick","2-Sick","3-OK","4-Good","5-Healthy,Energetic")) +
  theme_minimal() +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank())

Kendalls Correlation between health condition and focus time

df$Focus.Level..1.worst.5.best. <- as.numeric(df$Focus.Level..1.worst.5.best.)
df$Health.Condition..5.Best..1.worst. <- as.numeric(df$Health.Condition..5.Best..1.worst.)

cor(df$Focus.Level..1.worst.5.best.,df$Health.Condition..5.Best..1.worst.,method = "kendall",use = "na.or.complete")
## [1] 0.1391168
df$Focus.Level..1.worst.5.best. <- as.factor(df$Focus.Level..1.worst.5.best.)
df$Diet..1..worst..to.5..best. <- as.factor(df$Health.Condition..5.Best..1.worst.)

2.2.6.1 Insights of Health condition on Focus time

  • The mosaic plot shows how the focus time has varied over the health condition of mine.
  • There seems to exist a weak Positive association between health condition and focus time.

2.2.7 Mood on Focus Time

q6 <- table(df$Focus.Level..1.worst.5.best.,df$Positivity..1.worst.5.best.)
q6_prop <- round(prop.table(q6,margin = 2),2)*100
p6 <- addmargins(q6)
rownames(p6) <- c("<=10min","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins","Sum")
t6 <- as.matrix(p6)
z6 <- data.frame(q6_prop)
colnames(z6) <- c("Focus_Level","Mood","Count")

fig7 <- plot_ly(
  type = 'table',
  header = list(
    values = c("<b>Focussed Time</b>", "<b>Mood Rating:1</b>","<b>2</b>","<b>3</b>","<b>4</b>","<b>5</b>","<b>Sum</b>"),
  align = c('left', rep('center', ncol(t5))),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'rgb(235, 100, 230)'),
  font = list(family = "Arial", size = 14, color = "white")
  ),
  cells = list(
    values = rbind(
      rownames(t6), 
      t(as.matrix(unname(t6)))
    ),
    align = c('left', rep('center', ncol(t6))),
    line = list(color = "black", width = 1),
    fill = list(color = c('rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)')),
    font = list(family = "Arial", size = 12, color = c("black"))
  ))

fig7
ggplot(data = df) +
  geom_mosaic(aes(x = product(Positivity..1.worst.5.best., Focus.Level..1.worst.5.best.), fill = Positivity..1.worst.5.best.),
              ) + 
  labs(x = "Focus Level", 
       y = "Proportion", 
       title="Mood on Focus Time",
       subtitle = "Left - Right = (1) <10 mins - (5) >90 mins",
       caption = "Data Source:Bidit Notion Personal Database",
       tag="Fig-6") +
  scale_fill_manual(values=c("#440145FF", "#404788FF", "#238A8DFF", "#55C667FF", "#FDE725FF"), 
                    name="Mood",
                    breaks=c("1","2","3","4","5"),
                    labels=c("1-Worst","2-Bad","3-Moderate","4-Good","5-Too Good")) +
  theme_minimal() +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank())

Kendalls Correlation between mood levels and focus time

df$Focus.Level..1.worst.5.best. <- as.numeric(df$Focus.Level..1.worst.5.best.)
df$Positivity..1.worst.5.best. <- as.numeric(df$Positivity..1.worst.5.best.)

cor(df$Positivity..1.worst.5.best.,df$Focus.Level..1.worst.5.best.,method = "kendall",use="na.or.complete")
## [1] 0.07003648
df$Focus.Level..1.worst.5.best. <- as.factor(df$Focus.Level..1.worst.5.best.)
df$Positivity..1.worst.5.best. <- as.factor(df$Positivity..1.worst.5.best.)

2.2.7.1 Insights of Mood on Focus time

  • The mosaic plot shows how the focus time has been distributed on the levels based on the mood of that day.
  • There seems to be a weak positive association between mood and focus time.

2.2.8 Drinking Water Consumption on Focus Time

water_consumption_focus <- ggplot(df,aes(x=Focus.Level..1.worst.5.best., y=Water.Consumption.in.litre.,fill=Focus.Level..1.worst.5.best.))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab("Water Consumption(in litre)")+xlab("Focus Time")+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+labs(title="Water Consumption on Focus level",caption="Data Source:Bidit Personal Notion Database",subtitle="Figure-7")
water_consumption_focus

Kendalls Correlation for finding Association

df$Focus.Level..1.worst.5.best. <- as.numeric(df$Focus.Level..1.worst.5.best.)
cor(df$Water.Consumption.in.litre.,df$Focus.Level..1.worst.5.best.,method = "kendall")
## [1] 0.4719512

2.2.8.1 Insights Of water consumption on Focus time

  • There seems to a weak positive association between drinking water consumption and Focus time
  • From the boxplot we can see that the median water consumption for water is much higher when i have focussed for more than 60 mins.

2.2.9 Phone Usage on Focus Time

df$Focus.Level..1.worst.5.best. <- as.factor(df$Focus.Level..1.worst.5.best.)
phone_usage <- ggplot(df,aes(x=Focus.Level..1.worst.5.best., y=Phone.Time.in.mins.,fill=Focus.Level..1.worst.5.best.))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab("Phone Usage(in hr)")+xlab("Focus Time")+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+labs(title="Phone Usage Time on Focus level",caption="Data Source:Bidit Personal Notion Database",subtitle="Figure-8")

phone_usage

Kendalls Correlation for finding Association

df$Focus.Level..1.worst.5.best. <- as.numeric(df$Focus.Level..1.worst.5.best.)
cor(df$Phone.Time.in.mins.,df$Focus.Level..1.worst.5.best.,method = "kendall")
## [1] -0.2711844

2.2.9.1 Insights on Phone Usage on Focus time

  • There seems to be very weak negative association between phone usage time and focus time.
  • from the barplot we can see that the phone usage time seems to be significantly low in case when I have a high focus time.Similarly when I have a high phone usage I have lower focus time.

2.2.10 Sleep Time on Focus

df$Focus.Level..1.worst.5.best. <- as.factor(df$Focus.Level..1.worst.5.best.)
sleep_time <- ggplot(df,aes(x=Focus.Level..1.worst.5.best., y=Sleep.Time.day,fill=Focus.Level..1.worst.5.best.))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab("Sleep Time(in hr)")+xlab("Focus Time")+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+labs(title="Sleep Time on Focus level",caption="Data Source:Bidit Personal Notion Database",subtitle="Figure-9")

sleep_time

Kendalls Correlation for finding Association

df$Focus.Level..1.worst.5.best. <- as.numeric(df$Focus.Level..1.worst.5.best.)
cor(df$Sleep.Time.day,df$Focus.Level..1.worst.5.best.,method = "kendall")
## [1] -0.08045435

2.2.10.1 Insights on Sleep time on Focus

  • There seems to be a very weak negative association between sleep time and focus time.

2.2.11 Workout Time on Focus

df$Focus.Level..1.worst.5.best. <- as.factor(df$Focus.Level..1.worst.5.best.)
workout <- ggplot(df,aes(x=Focus.Level..1.worst.5.best., y=Workout.time.in.mins.,fill=Focus.Level..1.worst.5.best.))+geom_boxplot(alpha=0.3)+theme(legend.position = "none")+scale_fill_brewer(palette = "Dark2")+ylab("Workout Time(in hr)")+xlab("Focus Time")+scale_x_discrete(labels=c("<=10 mins","10 to 30 mins","30 to 60 mins","60 to 90 mins",">90 mins"))+labs(title="Workout Time on Focus level",caption="Data Source:Bidit Personal Notion Database",subtitle="Figure-10")

workout

Kendalls Correlation for finding Association

df$Focus.Level..1.worst.5.best. <- as.numeric(df$Focus.Level..1.worst.5.best.)
cor(df$Workout.time.in.mins.,df$Focus.Level..1.worst.5.best.,method = "kendall",use = "na.or.complete")
## [1] 0.3132672

2.2.11.1 Insights on Workout time on Focus time

  • There seems to be a weak positive association between workout time and focus time.

2.3 What I have learnt in overall ?

  • Overall my focus time has not been too much of concern in the 113 days it is more or less good.
  • My focus time has significantly weak negative association with sleep time and phone usage time, whereas a weak positive association with workout time and drinking water consumption.
  • I am mostly a negative minded minded person though my mood shows little to very little effects.
  • I need to take care of my health seriously as it shows a significant concern.But hopefully I have seriously exercised daily, maintained good diet and sleep time.
  • I am not so serious in my reading and extracurricular,I have read only for 13 days.